<!-- 我的问诊 -->
<template>
	<view>
		<view class="tabs-wrapper">
			<liuyuno-tabs :tabData="tabsData" :defaultIndex="1" @tabClick="tabClick" />
		</view>
		<view class="inquiry-wrapper" v-if="currentTabIndex == 0">
			<view class="item" v-for="item in dataList" @click="goToDetail(item)">
				<p class="time">询问时间【{{item.xdtime}}】</p>
				<div class="clearfix"></div>
				<p>接诊医生：{{item.z_name}}</p>
			</view>
			<u-empty v-if="dataList.length == 0" mode="list" icon="http://cdn.uviewui.com/uview/empty/car.png">
			</u-empty>
		</view>
		<view class="inquiry-wrapper" v-if="currentTabIndex == 1">
			<view class="item" v-for="item in dataList" @click="goToDetail(item)">
				<p class="time">询问时间【{{item.xdtime}}】</p>
				<div class="clearfix"></div>
				<p>接诊医生：{{item.z_name}}</p>
			</view>
			<u-empty v-if="dataList.length == 0" mode="list" icon="http://cdn.uviewui.com/uview/empty/car.png">
			</u-empty>
		</view>
	</view>
</template>

<script>
	import liuyunoTabs from "@/components/liuyuno-tabs/liuyuno-tabs.vue";
	export default {
		components: {
			liuyunoTabs
		},
		data() {
			return {
				tabsData: [{
						state: 1,
						name: '待接诊'
					},
					{
						state: 2,
						name: '已接诊'
					},
					// {
					// 	state: 3,
					// 	name: '已结束'
					// }
				],
				currentTabIndex: 0,
				dataList: []
			}
		},
		onLoad() {
			this.api_oderstate('1')
		},
		methods: {
			tabClick(val) {
				this.currentTabIndex = val
				if (val == '0') {
					this.api_oderstate('1')
				} else if(val == '1') {
					this.api_oderstate('2')
				} else if(val == '2') {
					this.api_oderstate('3')
				}
			},
			
			goToDetail(item) {
				console.log(item)
				uni.navigateTo({
					url: '/pages/onlineInquiry/inquiryDetail?id=' + item.id + '&back_orser=' + item.back_orser + '&zid=' + item.zid
				})
			},
			
			api_oderstate(ifpay) {
				this.djzList = []
				let openid = uni.getStorageSync('openid')
				this.$app._post_form("entry/wxapp/tuwen.oderstate", {
					openid: openid,
					ifpay: ifpay,
					key_words: 'tuwenwenzhen'
				}, (res) => {
					console.log(res)
					this.dataList = res
				})
			}
		}
	}
</script>

<style>
	>>>._item._active {
		color: #41C177 !important;
	}

	>>>._underline {
		background-color: #41C177 !important;
	}
</style>

<style lang="scss" scoped>
	.tabs-wrapper {
		background-color: #fff;
	}
	
	.inquiry-wrapper {
		padding: 10px;
	
		.item {
			padding: 10px;
			background-color: #fff;
			border-radius: 8px;
			color: #757575;
			font-size: .8rem;
			margin-bottom: 5px;
	
			p {
				line-height: 25px;
			}
	
			.time {
				color: #ff9800;
				float: left;
			}
		}
	}
</style>